import datetime
from applications.extensions import db


class YeOperationSetting(db.Model):
    __tablename__ = 'ye_operation_setting'
    __table_args__ = ({'comment': '操作设置表  - 用于保存各种操作的相关属性设置;例如-滑动操作,右键单双击,左键单击,输入文本,按键点击,长按'})  # 添加表注释
    id = db.Column(db.Integer, autoincrement=True, primary_key=True, comment="表id")
    # group_id = db.Column(db.Integer, comment="关联 所属组id")  
    # db.relationship('Role', secondary="admin_user_role", backref=db.backref('user'), lazy='dynamic')
    alias = db.Column(db.String(50), comment="别名")
    remarks = db.Column(db.String(500), comment="备注")
    operation_type = db.Column(db.String(50), comment="操作类型 click ,dbclick")
    position_way = db.Column(db.String(50), comment="定位方式(coordinate-坐标,picture-图片识别)")
    position_x = db.Column(db.DECIMAL(20,2), comment="x坐标")
    position_y = db.Column(db.DECIMAL(20,2), comment="y坐标")
    wait_time = db.Column(db.Integer, comment="等待时间(执行后等待时间,为0表示不等待 ms)")
    picture_url = db.Column(db.String(500), comment="操作定位图片(用于定位图片位置)")
    feature_point = db.Column(db.Integer, comment="特征点匹配数")
    operation_order = db.Column(db.Integer, comment="执行顺序(按照由小到大顺序执行操作)")
    sliding_length = db.Column(db.DECIMAL(20,2), comment="滑动长度")
    slide_direction = db.Column(db.DECIMAL(20,2), comment="滑动方向(360度)")
    text_content = db.Column(db.String(500), comment="输入文本内容")
    create_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间')
    update_time = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
    
    detection_id =  db.Column(db.Integer, comment="外键，关联检测id")
    # detection_id = db.relationship('YeOperationDetection', backref='yeOperationSetting', lazy='dynamic')
